<?php

namespace app\admin\controller;

use think\Controller;
use think\Request;
use think\Session;
use vquery;

/**
 * Description of Notice
 *
 * @author Administrator
 */
class Notice extends Check {

    public function __construct() {
        parent::__construct();
        $left = controller("index");
        $left->left();
    }

    public function index() {

        $list = db("parameter")->where("id=1")->find();
//        var_dump($list);
        $title = "参数设置";
        session("cue", "参数设置");
        $this->assign("title", $title);
        $this->assign("list", $list);
        return $this->fetch();
    }

    //保存公告
    public function save() {
        $data = input("post.");
        $exchange_rate = input("exchange_rate");
        $service_charge = input("service_charge");
        if ($exchange_rate == "" || $service_charge == "") {
            return ["status" => -1, 'message' => "请不要填写空值！"];
        }
        if (db("parameter")->where("id=1")->update($data)) {
            return ["status" => 1, 'message' => "保存成功！"];
        } else {
            return ["status" => 2, 'message' => "保存失败,内容无变化！"];
        }
    }

}
